
#ifndef __AUTO_LOCK_READ_H
#define __AUTO_LOCK_READ_H

#include "APRRWMutex.h"

class APRAutoLockRead
{
   public:
      APRAutoLockRead(APRRWMutex *i_rwmutex)
      {
         _rwmutex = i_rwmutex;
         _rwmutex->lockRead();
      }
      ~APRAutoLockRead()
      {
         if (_rwmutex) _rwmutex->unlock();
      }
      void TurnOff()
      {
         _rwmutex->unlock();
         _rwmutex = NULL;
      }
   private:
      APRRWMutex *_rwmutex;
};

#endif
